package Client.ui;


import javax.swing.JFrame;
import javax.swing.JButton;

import Client.Controler.AppliManager;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class AdminWindow {

	private JFrame frame;
	private AppliManager appliManager;

	/**
	 * Create the application.
	 */
	public AdminWindow(AppliManager app) {
		this.appliManager = app;
		initialize();
		this.frame.setVisible(true);
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.addWindowListener(new WindowAdapter() {
			@Override
			public void windowClosed(WindowEvent arg0) {
				appliManager.close();
				new MainWindow(appliManager);
			}
			@Override
			public void windowClosing(WindowEvent e) {
				appliManager.close();
				new MainWindow(appliManager);
			}
		});
		frame.setBounds(100, 100, 207, 151);
		frame.getContentPane().setLayout(null);
		frame.setTitle("Administration");
		
		JButton btnNewButton = new JButton("Connected users...");
		btnNewButton.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new ConnectedUsersWindow(appliManager);
			}
		});
		btnNewButton.setBounds(10, 11, 171, 23);
		frame.getContentPane().add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("Avatars list...");
		btnNewButton_1.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent arg0) {
				new AvatarsListWindow(appliManager);
			}
		});
		btnNewButton_1.setBounds(10, 45, 171, 23);
		frame.getContentPane().add(btnNewButton_1);
		
		JButton btnNewButton_2 = new JButton("See room...");
		btnNewButton_2.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new RoomDetailsWindow(appliManager);
			}
		});
		btnNewButton_2.setBounds(10, 79, 171, 23);
		frame.getContentPane().add(btnNewButton_2);
	}

}
